<div layout="column" layout-fill>
  <mat-toolbar color="primary" class="md-whiteframe-z1">
    <span>Login</span>
  </mat-toolbar>
  <div class="md-content" layout-padding flex>
    <div layout-gt-xs="row" layout-align-gt-xs="center start" class="margin">
      <div flex-gt-xs="50">
        <mat-card tdMediaToggle="gt-xs" [mediaClasses]="['push-top-lg']">
          <mat-card-title><mat-icon class="mat-icon-logo" svgIcon="assets:covalent"></mat-icon> Login</mat-card-title>
          <mat-card-subtitle>sign in via your current corporate account</mat-card-subtitle>
          <mat-divider></mat-divider>
          <mat-card-content>
            <form #loginForm="ngForm">
              <div layout="row">
                <mat-form-field flex> 
                  <input matInput #userElement #userControl="ngModel" placeholder="Username" type="text" maxlength="30" name="username" [(ngModel)]="username" required>
                  <span md-prefix><mat-icon>person</mat-icon></span>
                  <mat-hint align="start">
                    <span [hidden]="!userControl.errors?.required || userControl.pristine" class="tc-red-600">Required</span>
                  </mat-hint>
                  <mat-hint align="end">{{userElement.value.length}} / 30</mat-hint>
                </mat-form-field>
              </div>
              <div layout="row">
                <mat-form-field flex> 
                  <input matInput #passElement #passControl="ngModel" placeholder="Password" type="password" name="password" [(ngModel)]="password" required>
                  <span md-prefix><mat-icon>lock</mat-icon></span>
                  <mat-hint align="start">
                    <span [hidden]="!passControl.errors?.required || passControl.pristine" class="tc-red-600">Required</span>
                  </mat-hint>
                  <mat-hint align="end">Something hard to guess</mat-hint>
                </mat-form-field>
              </div>
            </form>
          </mat-card-content>
          <mat-divider></mat-divider>
          <mat-card-actions layout="row">
            <button flex mat-raised-button color="accent" [disabled]="!loginForm.form.valid" (click)="login()">Sign In</button>
          </mat-card-actions>
        </mat-card>
      </div>
    </div>    
  </div>
</div>